﻿using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ShowModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RevitHelloFramework
{
    [TransactionAttribute(TransactionMode.Manual)]
    public class Class1 : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            //TaskDialog.Show("Hello World", "Hello World");




            try
            {

                UIApplication uiApp = commandData.Application;
                Application application = uiApp.Application;
                UIDocument uIDocument = uiApp.ActiveUIDocument;

                Document document = uIDocument.Document;

                View view = document.ActiveView;



                MainWindow showViewWPF = new MainWindow(document);

                showViewWPF.Show();

                 



            }
            catch (Exception ex)
            {

                TaskDialog.Show("Error", ex.Message);
            }

              
            return Result.Succeeded;   
        }
    }
}
